One or more aspects relate, in general, to processing within a computing environment, and in particular, to processing associated with prefetch instructions.
Managed Runtime Environments, as well as other environments, may employ a garbage collection (GC) function to remove memory objects from a software heap that are no longer in use. This function typically has to access a large section, or perhaps all, of the heap to determine if an object is no longer referenced by any other object. Since a great deal of memory is accessed, the garbage collection function typically exploits prefetch instructions.
Examples of prefetch instructions include the Prefetch Data (PFD) and Prefetch Data Relative Long (PFDRL) instructions, as defined in the z/Architecture offered by International Business Machines Corporation, Armonk, N.Y. The prefetch instructions instruct the central processing unit (CPU) to prefetch data of a cache line into a local data cache prior to the time that data is needed. Therefore, when the CPU actually needs data from the cache line for a subsequent load or store instruction, it is typically already in the cache, or at least on its way to being delivered from a higher level cache or main memory.
In a Managed Runtime Environment (MRTE) or similar environment, the code that is generated is often compiled by a Just-In-Time (JIT) compiler using a JIT compilation technique. The JIT compiler typically generates prefetch instructions to improve performance by attempting to reduce the latency associated with cache misses.
In many cases, speculative prefetch requests are issued. This typically occurs when it is not known if a future branch path will be taken, but there is a chance to prefetch anyway. These speculative prefetches often significantly increase the number of prefetch requests the CPU is to process. However, in many cases these speculative prefetches do not improve performance, if the data is never actually needed, and can actually decrease overall performance due to wasted cache bandwidth.